// 引入封装的axios
import serve from "@/utils/serve";


// 定义注册发送请求的参数值类型
interface paramsData {
  phone:string,
  password:string,
  code:string
}
// 定义获取验证码成功的返回值类型
export interface resData {
  code:number,
  data:string,
  message:string,
  ok:boolean
}

export default {
  /**
   * @description 获取验证码
   * @url /api/user/passport/sendCode/{phone}
   * @param phone 手机号
   */
  reqSendCode(phone:string){
    return serve.get<any,resData>(`/api/user/passport/sendCode/${phone}`)
  },

  /**
   * @description 用户注册
   * @url /api/user/passport/register
   * @param params 请求体参 {phone,password,code}
   * @returns Promise<null>
   */
  reqRegister(params:paramsData){
    return serve.post<any,resData>('/api/user/passport/register', params)
  }
}